package com.schpro.webexperiment.service.impl;

import com.schpro.webexperiment.dao.WxExeMapper;
import com.schpro.webexperiment.dataobject.WxExe;
import com.schpro.webexperiment.model.Exercise;
import com.schpro.webexperiment.service.ExeService;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * exercise service impl
 *
 * @author lss
 * @date 2019-02-26, Tue
 */
@Service
public class ExeServiceImpl implements ExeService {

  /**
   * exercise mapper
   */
  @Autowired
  private WxExeMapper exeMapper;


  @Override
  public List<Exercise> getAllExercises() {
    return exeMapper.selectAll().stream().map(Exercise::new).collect(Collectors.toList());
  }

  @Override
  public void insert(WxExe exe) {
    exeMapper.insert(exe);
  }
}
